const jwt = require('jsonwebtoken')
const jwtScrect = 'zx_first_jwt'

module.exports = {
  setToken (user) {
      return jwt.sign(user, jwtScrect, { expiresIn: '24h' })
  },
  getToken (token) {
    try {
      return jwt.verify(token, jwtScrect)
    } catch (error) {
      throw error
    }
    
  }
}